<template>
  <div>
    <!-- 3.遍历 -->
    <v-button
      v-for="item in arr"
      :key="item.id"
      @click="$router.push('/list?id=' + item.id)"
      >{{ item.catename }}</v-button
    >
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      // 1.初始化数据
      arr: [],
    };
  },
  mounted() {
    //2.发请求
    axios({
      url: "/api/getcate",
      method: "get",
    }).then((res) => {
    //   console.log(res);
      this.arr = res.data.list;
    });
  },
};
</script>


<style lang="less" scoped>
@import "../../../less/index.less";

</style>